package fr.greta.centre.action;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import fr.greta.centre.dao.CandidatureDAOImpl;
import fr.greta.centre.dao.EtatDAOImpl;
import fr.greta.centre.metier.Candidature;
import fr.greta.centre.metier.Etat;

/**
 * Servlet implementation class GererCandidatures
 */
public class GererCandidatures extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public GererCandidatures() {
        super();
        
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
		
		List<Candidature> lesCandidatures = null;
		List<Etat> lesEtats = null;
		
		try {
			lesCandidatures = new CandidatureDAOImpl().findAll();
			lesEtats = new EtatDAOImpl().findAll();
			
			request.setAttribute("lesCandidatures", lesCandidatures);
			request.setAttribute("lesEtats", lesEtats);
			
		} catch (SQLException e) {
			e.printStackTrace();
		}
		request.getRequestDispatcher("candidatures.jsp").forward(request, response);

	}

	
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		
	}

}
